﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>加载图像时的错误提示</title>
    <script>
        function ImgLoad() {
            document.images[0].onerror = function () {
                alert("你调用的图像并不存在\n");
            };
            document.images[0].src = "test.gif";
        }
    </script>
</head>
<body onload="ImgLoad()">
    <img />
</body>
</html>